package com.poker.wiki.job;

import com.poker.wiki.Service.EbookSnapshotService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class EbookSnapshotJob {

    @Resource
    EbookSnapshotService ebookSnapshotService;

    /**
     * 自定义cron表达式
     * 只有等上一次执行完成，下一次才会在下一个时间点执行，错过就错过
     */
    @Scheduled(cron = "5/30 * * * * ?")
    public void cron() throws InterruptedException {
        long stat = System.currentTimeMillis();
        ebookSnapshotService.getEbookSnapshot();
//        System.out.println("更新了电子书快照，耗时：" + (System.currentTimeMillis() - stat));
    }

}
